/*
 * Created on Wed Jun 06 2018 by Ronnie Ren (zhaosong.ren) from Accenture
 *
 * Copyright (c) 2018 DingXing information & technology limited company.
 */

import { Injectable } from "@angular/core";
import { SqliteService } from "../../../services/sqliteDB/sqlite.service";
import { Observable } from "rxjs";
import { InspectionPersonnelDto } from "../../dto/inspection/inspection-personnel.dto";
import { CurdService } from "../curd.service";


@Injectable()
export class InspectionPersonnelService {

  constructor(private sqliteService: SqliteService, private curdService: CurdService) {

  }


//   fetchAllUserIds(): Observable<Array<string>> {
//     return Observable.fromPromise(this.sqliteService.simpleFetch(InspectionTypeDto, ["id"]))
//       .map((rows: { results: Array<{ id: string }> }) => {
//         return Array.from(rows.results).map((item) => item.id);
//     });
//   }

  getPersonnel(id) {
    return Observable.fromPromise(this.curdService.fetchByCondition(InspectionPersonnelDto, {and: {companyId: id}}));
  }

}
